<template>
	<!-- 拒绝退货 & 修改理由 弹窗 -->
	<view class="item-info" :class="showBillInfo === 0 ? 'none' : showBillInfo === 1 ? 'show' : ''">
		<view class="cate-content">
			<view class="item-fixed-top">
				<view class="title">{{title}}</view>
				<view class="close" @click="close">
					<image src="../../static/images/close.png" mode="scaleToFill"></image>
				</view>
			</view>
			<view class="comm-list cate-list">
				<view class="item" v-for="(item,index) in data" :key="index">
					<view class="item-a">
						<view class="item-title">买家</view>
						<view v-if="item.etime_txt">{{item.etime_txt}}</view>
						<view >买家提交退货申请,等待商户审批</view>
						<view v-if="item.reason">退货原因: {{item.reason}}</view>
						<view v-if="item.txt">退货说明: {{item.txt}}</view>
						<view v-if="item.cellphone">手机号码: {{item.cellphone}}</view>
					</view>
					<view class="bg-color" v-if="item.status_act">
						<view class="item-title">卖家</view>
						<view v-if="item.etime_cp_txt">{{item.etime_cp_txt}}</view>
						<view v-if="item.status_act && item.status_act.status_txt">单据状态: {{item.status_act.status_txt}}</view>
						<view v-if="item.txt_cp">理由: {{item.txt_cp}}</view>
					</view>
				</view>
				<view class="btnClass" @click="edtBtnFun" v-if="(data.length && ask_rt_status_act.acts.edt && ask_rt_status_act.acts.edt.act == 'edt')">{{ask_rt_status_act.acts.edt.title}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import staticConst from "../../js/const/StaticConst.js";
	import util from '../../js/util/Util.js';
	import config from "../../js/conf/Config.js";
	export default {
		props:[ "title" ],
		data() {
			return {
				showBillInfo : 0,
				data : [],
				ask_rt_status_act: {},
			};
		},
		methods: {
			
			/***  获取协商记录数据  ORDER_RETURN_INFO ***/
			async loadOrderReturn(odid)
			{
				let url = config.YY_ORDER_ORDER_RETURN_INFO;
				let param = {};
				param.odid = odid;
				let res = await this.$api({url:url,data:param});
				if( !res || !res.data || !res.data.ask_ls ) return;
				this.data = res.data.ask_ls;
			},
			
			/**显示分类面板 type:0付款记录，1：操作记录**/
			toggleBillsStateMask(type,data) 
			{
				if(data)
					this.loadOrderReturn(data.odid);
				let timer = type === 'show' ? 10 : 200;
				let state = type === 'show' ? 1 : 0;
				this.showBillInfo = 2;
				setTimeout(() => {
					this.showBillInfo = state;
				}, timer);
				if(!type)
				{
					this.data = [];
				}
			},
			
			close()
			{
				this.toggleBillsStateMask();
			},
			
			edtBtnFun () {
				this.close()
				this.$emit('orderOpration',this.ask_rt_status_act.acts.edt.act)
			},
		},
	}
</script>
<style lang="scss">
	.item-info {
		position: fixed;
		z-index: 999;
		left: 0;
		top: 0;
		bottom: 0;
		width: 100%;
		background: #FFF;
		transition: 0.3s;
		overflow-y: hidden;
		display: flex;
		align-items: center;
		justify-content: center;
		.cate-content {
			border-radius: 6px;
			overflow: hidden;
			width: 500px;
			background: #F8F8F8;
			float: right;
			transform: translateY(-100%);
			transition: 0.3s;
			position: relative;
			.item-fixed-top
			{
				height: 50px;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 14px;
				border-bottom: 1px solid #ECECEC;
				.title
				{
					font-size: 16px;
				}
				.close
				{
					position: absolute;
					right: 5px;
					top: 12px;
					width: 32px;
					height: 32px;
					text-align: center;
					cursor: pointer;
					image
					{
						width: 14px;
						height: 14px;
					}
				}
			}
		}
	
		&.none {
			display: none;
		}
		&.show {
			background: rgba(0, 0, 0, 0.3);
			.cate-content {
				transform: translateY(0);
			}
		}
	}
	.bg-color
	{
		background: #E6E6E6;
		padding: 10px;
	}
	.cate-list
	{
		max-height: 410px;
		.btnClass {
			width: 100%;
			height: 55px;
			text-align: center;
			line-height: 55px;
			font-size: 14px;
			background: #3388ff;
			color: #FFFFFF;
			cursor: pointer;
		}
		.item
		{
			font-size: 15px;
			.item-a
			{
				padding: 10px;
			}
			.item-title
			{
				font-size: 16px;
				font-weight: 700;
			}
		}
	}
</style>